<!DOCTYPE html>
<html lang="en">
<head>
	<title></title>
	<meta charset="UTF-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap-responsive.min.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/uniform.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-style2.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/matrix-media.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/font-awesome/css/font-awesome.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/changyun.css?v={#$Think.config.ADMIN_VERSION_VAL}"/>
	<style>
		.control-group .controls label {
			display: inline-block;
		}

		ul, li {
			list-style: none;
		}

		.upload_img_list {
			width: 100%;
			display: block;
		}

		.upload_img_list li {
			float: left;
			margin-right: 5px;
			margin-bottom: 10px;
		}

		.upload_img_list li img {
			width: 80px;
			height: 80px;
			border: 1px solid #cccccc;
			padding: 1px;
		}

		.tab_on_select {
			background: #5bb75b;
		}

		.tab_on_select a {
			color: #ffffff;
		}

		.J_imageView {
			padding-top: 5px;
		}

		.J_imageView li {
			width: 100px;
			height: 100px;
			float: left;
			margin-right: 15px;
			position: relative;
			margin-bottom: 10px;
		}

		.J_imageView li img {
			width: 100px;
			height: 100px;
			border: 1px solid #eeeeee;
			padding: 1px;
		}

		.del_pic {
			position: absolute;
			top: -5px;
			right: -5px;
			background-color: rgba(0, 0, 0, 0.5);
			color: #ffffff;
			width: 25px;
			height: 25px;
			border-radius: 50%;
			text-align: center;
			cursor: pointer;
		}

	</style>
	<script>
	var BASE_URL = '{#$base_url}';
	var STORE_URL = "{#$admin_url}";
	</script>
</head>
<body>
<div id="content">

	<include file="Public/maintop"/>

	<div class="container-fluid" style="padding:0px 10px;">
		<div class="row-fluid">
			<div class="span12">

				<div class="widget-box">
					<div class="cyz-m-tab">
						<ul class="cyz-m-tab-title">
							<li class="cyz-m-this" data-toggle="nav_tab" href="#tab1">基本信息</li>
							<li data-toggle="nav_tab" href="#tab2">企业简介</li>
							<!--							<li data-toggle="nav_tab" href="#tab4">展示信息</li>-->
						</ul>
					</div>
					<div class="widget-content">
						<form action="{#$this_url_action}" method="post" class="form-horizontal" id="form_basic_validate">
							<div id="tab1" class="tab-pane active">
								<div class="widget-content nopadding">

									<div class="control-group">
										<label class="control-label"><span class="cyzFontRed">* </span>企业名称(中文) :</label>
										<div class="controls">
											<input type="text" class="span5" name="company_name" value="{#$info.company_name}"/>
										</div>
									</div>


									<div class="control-group">
										<label class="control-label">企业名称(英文) :</label>
										<div class="controls">
											<input type="text" class="span5" name="company_name_eg" value="{#$info.company_name_eg}"/>
										</div>
									</div>
									<!--									<div class="control-group">-->
									<!--										<label class="control-label"><span class="cyzFontRed">* </span>介绍名称 :</label>-->
									<!--										<div class="controls">-->
									<!--											<input type="text" class="span5" name="company_jianjie_name" value="{#$info.company_jianjie_name}"/>-->
									<!--										</div>-->
									<!--									</div>-->
									<!--									<div class="control-group">-->
									<!--										<label class="control-label"><span class="cyzFontRed">* </span>企业网址 :</label>-->
									<!--										<div class="controls">-->
									<!--											<input type="text" class="span5" name="company_link_url" value="{#$info.company_link_url}"/>-->
									<!--										</div>-->
									<!--									</div>-->
									<!--									<div class="control-group">-->
									<!--										<label class="control-label">企业LOGO（500*500）:</label>-->
									<!--										<div class="controls">-->
									<!--											<div class="upload_img_list" id="lit_pic_one_data">-->
									<!--												<notempty name="info.company_logo">-->
									<!--													<li><img src="{#$info.company_logo}"/></li>-->
									<!--												</notempty>-->
									<!--											</div>-->
									<!--											<input type="hidden" class="span5" name="company_logo"-->
									<!--													id="lit_pic_one_data_value" value="{#$info.company_logo}"/>-->
									<!--											<div style="width:100%;display: inline-block;">-->
									<!--												<a href="javascript:void(0);" onclick="upOneImage('one_data');"-->
									<!--														class="btn btn-success" style="padding:5px 12px;">上传图片</a>-->
									<!--											</div>-->
									<!--											<div class="Validform_checktip">建议尺寸400x217px</div>-->
									<!--										</div>-->
									<!--									</div>	-->
									<div class="control-group">
										<label class="control-label">企业公众号:</label>
										<div class="controls">
											<div class="upload_img_list" id="lit_pic_two_data">
												<notempty name="info.company_contact_weixin_img">
													<li><img src="{#$info.company_contact_weixin_img}"/></li>
												</notempty>
											</div>
											<input type="hidden" class="span5" name="company_contact_weixin_img"
													id="lit_pic_two_data_value" value="{#$info.company_contact_weixin_img}"/>
											<div style="width:100%;display: inline-block;">
												<a href="javascript:void(0);" onclick="upOneImage('two_data');"
														class="btn btn-success" style="padding:5px 12px;">上传图片</a>
											</div>
											<div class="Validform_checktip">建议尺寸400x217px</div>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">企业地址 :</label>
										<div class="controls">
											<input type="text" class="tpl-form-input" style="width:500px;float: left;" id="company_address" name="company_address" placeholder="请输入详细地址" value="{#$info.company_address}">
											<input type="hidden" name="company_lng" id="company_lng" value="{#$info.company_lng}"/>
											<input type="hidden" name="company_lat" id="company_lat" value="{#$info.company_lat}"/>
											<button type="button" class="btn btn-success" id="mapseacrh" style="padding:5px 10px;">搜索地址</button>
											<div style="clear: both;"></div>
											<small>请输入详细地址，如：河南省郑州市西三环国家创业园。然后点击搜索，坐标可自动获取</small>
											<div style="clear: both;"></div>
											<div id="map" style="width:50%;height:400px;"></div>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">企业地址(英文) :</label>
										<div class="controls">
											<input type="text" class="tpl-form-input" style="width:500px;float: left;" id="company_address_eg" name="company_address_eg" placeholder="请输入详细地址" value="{#$info.company_address_eg}">
										</div>
									</div>
									<!--								<div class="control-group">-->
									<!--									<label class="control-label">证券简称 :</label>-->
									<!--									<div class="controls">-->
									<!--										<input type="text" class="tpl-form-input" style="width:500px;float: left;" id="zhengquan_name" name="zhengquan_name" placeholder="请输入证券明" value="{#$info.zhengquan_name}">-->
									<!--									</div>-->
									<!--								</div>-->
									<!--								<div class="control-group">-->
									<!--									<label class="control-label">证券代码 :</label>-->
									<!--									<div class="controls">-->
									<!--										<input type="text" class="tpl-form-input" style="width:500px;float: left;" id="zhengquan_num" name="zhengquan_num" placeholder="证券代码" value="{#$info.zhengquan_num}">-->
									<!--									</div>-->
									<!--								</div>-->
									<div class="control-group">
										<label class="control-label">公司网址 :</label>
										<div class="controls">
											<input type="text" class="span5" name="c_www_url" value="{#$info.c_www_url}"/>
										</div>
									</div>
									<div class="control-group" id="c_fax">
										<label class="control-label">传真 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_fax" value="{#$info.c_fax}"/>
										</div>
									</div>
									<div class="control-group" id="c_telephone">
										<label class="control-label">电话 :</label>
										<div class="controls">
											<input type="text" class="span3" name="c_telephone" value="{#$info.c_telephone}"/>
										</div>
									</div>
								</div>
							</div>
							<div id="tab2" class="tab-pane" style="display: none;">
								<div class="control-group">
									<label class="control-label">企业简介 :</label>
									<div class="controls">
										<textarea name="company_jianjie" id="company_jianjie" style="width:750px;height: 350px">{#$info.company_jianjie}</textarea>
									</div>
								</div>
							</div>
							<div class="form-actions">
								<input type="hidden" name="id" value="{#$info.id|default=''}">
								<button type="submit" class="btn btn-success">保存</button>
							</div>
						</form>
					</div>
				</div>

			</div>
		</div>
		<hr>
	</div>
</div>
<textarea id="upload_editor" style="width: 0;height: 0;display: none;"></textarea>
</div>
<!-- 文件库弹窗 -->
<script src="__PUBLIC__/Admin/js/jquery.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.ui.custom.js"></script>
<script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/jquery.uniform.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.js"></script>
<script src="__PUBLIC__/Admin/js/matrix.tables.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/js/Validform.min.js"></script>
<script src="__PUBLIC__/js/laydate/laydate.js"></script>
<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__PUBLIC__/ueditor/ueditor.all.js?v=123456" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
// 富文本编辑器
UE.getEditor('company_jianjie', {autoHeightEnabled: false, serverUrl: "{#:U('NewUpload/upload')}"});
var t_show_flow = $('.t_show_flow').length;
for (var i = 0; i < t_show_flow; i++) {
	UE.getEditor('xiangqing' + i, {autoHeightEnabled: false, serverUrl: "{#:U('NewUpload/upload')}"});
}

function appendShowFlow() {
	var start = $('.t_show_flow').length;
	var add_id = start - 1;
	$('#show_arr_' + add_id).after(`
			<div id="show_arr_${start}" class="t_show_flow">
				<div class="controls" style="padding:2px;">
					<div class="add-on-div">展示${start + 1}</div>
					<div class="input-append">
					    <input type="text"  style="width: 300px" name="show_arr[nickname][]" placeholder="请输入展示名称~"/>
					</div>
				</div>
				<div class="controls" id="show_img_${start}">
					<div class="upload_img_list" id="lit_pic_show_${start}_data"></div>
					<input type="hidden" class="span5" name="show_arr[avatar][]" id="lit_pic_show_${start}_data_value" value=""/>
					<div style="width:100%;display: inline-block;">
						<a href="javascript:void(0);" onclick="upOneImage('show_${start}_data')" class="btn btn-success" style="padding:5px 12px;">上传相片</a>
					</div>
				</div>
				<div class="controls">
				<textarea name="show_arr[xiangqing][]" id="xiangqing${start}" style="width:750px;height: 350px"></textarea>
				</div>
				<a style="margin-left:200px" href="###" class="btn btn-danger" onClick="removeShowFlow(this);">- 删除展示</a>
			</div>
		`);
	console.log("xiangqing" + start);
	UE.getEditor("xiangqing" + start, {autoHeightEnabled: false, serverUrl: "{#:U('NewUpload/upload')}"});
	$('#show_arr_' + start).find('input[type=radio]').uniform();

}

function removeShowFlow(e) {
	$(e).parent().remove();
	$('.t_show_flow').each(function(index, item) {
		$(item).attr('id', `show_arr_${index}`)
		$(item).find('.add-on-div').text('展示' + (index + 1))
	})
}

var ue_uploader = UE.getEditor('upload_editor', {autoHeightEnabled: false, serverUrl: "{#:U('NewUpload/upload')}"});

function upOneImage(fname) {
	ue_uploader.ready(function() {
		var pickey = 1;
		ue_uploader.addListener('beforeInsertImage', function(t, arg) {
			if (pickey == 1) {
				$("#lit_pic_" + fname).html('<li><img src="' + arg[0].src + '" /></li>');
				$("#lit_pic_" + fname + "_value").val(arg[0].src);
			}
			pickey++;
		});
	});
	var myImage = ue_uploader.getDialog("insertimage");
	myImage.render();
	myImage.open();
}

$("#J_imageView").on('click', ".del_pic", function() {
	$(this).parent("li").remove();
});
$("#J_zhiliang_arr").on('click', ".del_pic", function() {
	$(this).parent("li").remove();
});

function upMoreImage(fname, name, del_pic) {
	var myImage = ue_uploader.getDialog("insertimage");
	myImage.open();
	ue_uploader.ready(function() {
		var pickey = 1;
		ue_uploader.addListener('beforeInsertImage', function(t, arg) {
			if (pickey == 1) {
				$.each(arg, function(i, data) {
					$("." + fname + "_imglist").append('<li><img src="' + data.src + '"><input type="hidden" name="' + name + '[]" value="' + data.src + '"><div class="' + del_pic + '"><i class="icon-remove"></i></div></li>');
				});
			}
			pickey++;
		});
	});
}

$(function() {
	$('[data-toggle="nav_tab"]').on('click', function() {
		var self = $(this);
		self.parent().children("li").removeClass("cyz-m-this");
		$(".tab-pane").hide();
		self.addClass("cyz-m-this");
		$(self.attr("href")).show();
	});
	var loadi = null;
	var demo1 = $("#form_basic_validate").Validform({
		tiptype: 3,
		ajaxPost: true,
		postonce: true,
		tiptype: function(msg, o, cssctl) {
			if (!o.obj.is("form")) {
				var objtip = o.obj.siblings(".Validform_checktip");
				cssctl(objtip, o.type);
				objtip.text(msg);
			}
		},
		beforeSubmit: function(curform) {
			loadi = layer.load('表单正在处理中，请稍等 ...');
		},
		callback: function(data) {
			layer.close(loadi);
			if (data.status == 1) {
				layer.alert(data.msg, {icon: 1}, function() {
					window.location.href = "{#:U('index')}";
				});
			} else {
				layer.alert(data.msg, {icon: 0});
			}
		}
	});

	$("img").click(function() {
		var img_url = $(this).attr('src');
		layer.open({
			type: 1,
			title: false,
			closeBtn: 0,
			area: ['600px', '600px'],
			skin: 'layui-layer-nobg',
			shadeClose: true,
			content: '<img src="' + img_url + '" />'
		});
	});
});

</script>
<script charset="utf-8" data-map="腾讯地图" src="//map.qq.com/api/js?v=2.exp&key=7AYBZ-EQCL4-4PFUT-X4GGH-7KO26-KMBQ6"></script>
<script type="text/javascript">
// 腾讯地图调用
$(function() {
	var geocoder, citylocation, map, marker = null;
	var markersArray = [];
	var x = '{#$info.company_lng}';
	var y = '{#$info.company_lat}';
	var center = new qq.maps.LatLng(y, x);
	map = new qq.maps.Map(document.getElementById('map'), {
		center: center,
		zoom: 13
	});
	marker = new qq.maps.Marker({
		position: new qq.maps.LatLng(y, x),
		map: map
	});

	//获取城市列表接口设置中心点
	if (y == '' || x == '') {
		citylocation = new qq.maps.CityService({
			complete: function(result) {
				map.setCenter(result.detail.latLng);
			}
		});
		//调用searchLocalCity();方法  根据用户IP查询城市信息。
		citylocation.searchLocalCity();
	}
	//绑定单击事件添加参数
	qq.maps.event.addListener(map, 'click', function(event) {
		marker.setMap(null);
		$("#company_lng").prop("value", "");
		$("#company_lng").prop("value", event.latLng.getLng());
		$("#company_lat").prop("value", "");
		$("#company_lat").prop("value", event.latLng.getLat());
		marker = new qq.maps.Marker({
			position: new qq.maps.LatLng(event.latLng.getLat(), event.latLng.getLng()),
			map: map
		});
	});
	geocoder = new qq.maps.Geocoder({
		complete: function(result) {
			marker.setMap(null);
			map.setCenter(result.detail.location);
			marker = new qq.maps.Marker({
				map: map,
				position: result.detail.location
			});
			$("#company_lat").prop("value", marker.position.lat);
			$("#company_lng").prop("value", marker.position.lng);
		}
	});
	$("#mapseacrh").click(function() {
		var address = $("#company_address").val();
		geocoder.getLocation(address);
	});
});
</script>
</body>
</html>
